<template>
	<view class="">
		
		<button @click="show">show311</button>
	</view>
</template>

<script setup>
	
	import { createPhantom, Position } from "@phantom/wallet-sdk";
	// console.log(createPhantom,'createPhantom');
	import {ref} from 'vue'
	// 创建一个全局对象
	let globalWallet = {
	  solana: null,
	};
	
	
	
	
	const phantom = ref({})
	const initphantom =  async () =>{
		console.log(231);
		// 在需要的地方赋值
		globalWallet.solana = await createPhantom(
		{
		  position: Position.bottomRight, // Choose from bottomRight, bottomLeft, topRight, topLeft
		  hideLauncherBeforeOnboarded: false,
		  namespace: "my-app12",
		});
		
		try{
			phantom.value = await createPhantom({
			  position: Position.bottomRight, // Choose from bottomRight, bottomLeft, topRight, topLeft
			  hideLauncherBeforeOnboarded: false,
			  namespace: "my-app",
			});
		}catch(e){
			console.log('e',err);
		}
		// console.log(globalWallet,'globalWallet');
		// console.log('3333');
		
	}
	initphantom()
	
	const show = () => {
		console.log(globalWallet.solana,'gol');
		// console.log(window,'window');
		// console.log(window.solana,'window.solana');
		phantom.value.show();
	}
	
	// Show the wallet UI
	
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
